<template>
	<view class="content">
<u-navbar title="石头转账"  :autoBack="true">
	</u-navbar>
		<view class="info">

			<view class="c1">收款ID</view>
			<view class="c2">
				<u--input v-model='form.to_partner_account' placeholder="请输入" :customStyle="{padding: '0 32rpx'}">
				</u--input>
			</view>
			<view class="c1">石头数量</view>
			<view class="c2">
				<u--input v-model='form.amount' placeholder="请输入" :customStyle="{padding: '0 32rpx'}">
				</u--input>
			</view>
			<view class="c1">转账附言</view>
			<view class="c2">
				<u--input type="textarea" style="" v-model='form.notice' placeholder="请输入"
					:customStyle="{padding: '0 32rpx'}">
				</u--input>
			</view>

		</view>

		<view class="but">
			<view class="s2" @click="toStoneTransfer()">
				<text>提 交</text>
			</view>
		</view>


	</view>
</template>

<script>
	import {
		stoneTransfer_api
	} from '@/api/second.js'
	import conf from '@/common/config.js';
	export default {

		data() {
			return {
				form: {
					stone_type: '',
					to_partner_account: '',
					amount: '',
					notice: '',
				}
			};
		},
		onLoad({
			type
		}) {
			this.form.stone_type = type
		},

		methods: {
			toStoneTransfer() {
				if (!this.form.to_partner_account) return this.$u.toast('请输入收款ID')
				if (!this.form.amount) return this.$u.toast('请输入石头数量')
				if (!/^[1-9]\d*$/.test(this.form.amount)) return this.$u.toast('石头数量必须为整数')
				
				uni.showModal({
					title: '温馨提示',
					content: `确认向帐号${this.form.to_partner_account}转石头${this.form.amount}个吗？`,
					success: (res) => {
						if (res.confirm) {
							stoneTransfer_api(this.form).then(res => {
								this.$u.toast('转账成功')
								uni.$emit('updatenum')
								setTimeout(() => {
									uni.navigateBack()
								}, 500)
							})
						}
					}

				})

			},

		}
	}
</script>

<style lang="scss">
	.c3 {
		margin-top: 40rpx;
	}

	.tips {
		font-size: 28rpx;
		color: #7677EB;
	}

	.content {
		width: 670rpx;
		margin: 0 auto;
	}

	.info {
		width: 566rpx;
		padding: 52rpx;
		margin: 52rpx auto;
		background-color: #fff;
		border-radius: 48rpx;
		@include flex(column);

		.avatar {
			image {
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
			}
		}

		.c1 {
			height: 28rpx;
			font-size: 28rpx;
			font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
			font-weight: 400;
			color: #7D8592;
			line-height: 28rpx;
			margin-top: 56rpx;
		}

		.c2 {
			width: 566rpx;
			margin-top: 40rpx;
			position: relative;

			/deep/ .u-input {
				height: 98rpx;
				border-radius: 28rpx;
			}

			.on_in {
				position: absolute;
				inset: 0;
			}
		}

		.qrcode {
			@include flex;
			justify-content: space-between;
			align-items: center;

			image {
				width: 128rpx;
				height: 128rpx;
				margin-top: 24rpx;
			}
		}

	}

	.but {
		@include flex;
		margin-top: 60rpx;
		margin-bottom: 60rpx;

		.s2 {
			width: 290rpx;
			height: 96rpx;
			background: #7677EB;
			box-shadow: 0 12rpx 24rpx 0 rgba(63, 140, 255, 0.2637);
			border-radius: 28rpx;
			margin: 0 auto;
			text-align: center;

			text {
				font-size: 30rpx;
				font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
				font-weight: 400;
				color: #FFFFFF;
				line-height: 96rpx;
			}
		}
	}
</style>s